import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

// Une classe pour chaque ligne du dataset avec les attributs
public class Data 
{
	
	public Data(int season, int year, int month, int holiday, int weekday, int workday, int weather, float temp, float atemp, float hum, float windspeed, float rental) {
		this.season = (float)season;
		this.year = (float)(year);
		this.month = (float)(month); // Probablement de la scrap comme data
		this.holiday = (float)holiday;
		this.weekday = (float)weekday;
		this.workday = (float)workday;
		this.weather = (float)weather; // Probablement devoir ponderer ce parametre la (1 = clear weather)
		this.temp = temp;
		this.atemp = atemp;
		this.hum = hum;
		this.windspeed = windspeed;
		this.rental = rental;
	}

	float season;
	float year;
	float month;
	float holiday;
	float weekday;
	float workday;
	float weather;
	float temp;
	float atemp;
	float hum;
	float windspeed;
	float rental;

	//Retourne le nombre de location
	public float getRental() {
		return rental;
	}



	@Override
	public String toString() {
		return "Data [season=" + season + ", year=" + year + ", month=" + month
				+ ", holiday=" + holiday + ", weekday=" + weekday
				+ ", workday=" + workday + ", weather=" + weather + ", temp="
				+ temp + ", atemp=" + atemp + ", hum=" + hum + ", windspeed="
				+ windspeed + ", rental=" + rental + "]";
	}


	// Calcul le score en fonction de la distance entre deux exemples
	public float getScore(Data data, float[] weight) {
		float score = weight[0]*Math.abs(data.season - this.season);
		score += weight[1]*Math.abs(data.year - this.year);
		score += weight[2]*Math.abs(data.month - this.month);
		score += weight[3]*Math.abs(data.holiday - this.holiday);
		score += weight[4]*Math.abs(data.weekday - this.weekday);
		score += weight[5]*Math.abs(data.workday - this.workday);
		score += weight[6]*Math.abs(data.weather - this.weather);
		score += weight[7]*Math.abs(data.temp - this.temp);
		score += weight[8]*Math.abs(data.atemp - this.atemp);
		score += weight[9]*Math.abs(data.hum - this.hum);
		score += weight[10]*Math.abs(data.windspeed - this.windspeed);
		return score;
	}

	
}
